﻿// DigitalDesign
// Project: InformationBoard
// Developer: Bobylev Dmitry
// Created: 13.11.2011
// Last change: 16.11.2011
// Description: methods of server settings page.

using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using GUIAdmin.VideoServiceReference;
using System.ComponentModel;

namespace GUIAdmin.Views
{
    public partial class Server : Page
    {
        private VideoServiceClient videoClient = new VideoServiceClient();

        public Server()
        {
            InitializeComponent();
        }

        // Выполняется, когда пользователь переходит на эту страницу.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            videoClient.GetVideoDirectoryCompleted +=
                new System.EventHandler<GetVideoDirectoryCompletedEventArgs>
                    (videoClient_GetVideoDirectoryCompleted);
        }

        private void videoClient_GetVideoDirectoryCompleted(object sender, GetVideoDirectoryCompletedEventArgs e)
        {
            if (e.Result != null)
                VideoPath.Text = e.Result;
        }

        //сохранение измения директории с видео
        private void SaveDirectory_Click(object sender, RoutedEventArgs e)
        {
            if( VideoPath.Text != "")
                videoClient.SetVideoDirectoryAsync(VideoPath.Text);
        }

    }
}
